<html>

<head>
    <!-- <script src="https://cdn.bootcss.com/rxjs/6.4.0/rxjs.umd.js"></script> -->
    <script src="Js/rxjs.umd.js" type="text/javascript"></script>
    <script>
        var a = {
            getString(payload, resolve) {
                resolve(`myStr-${payload}`);
            },
            async delay(payload) {
                let p = new Promise(resolve => {
                    setTimeout(this.getString, 3000, payload, resolve);
                });
                let str = await p;
                return str;
            },

            createObservable() {
                let ob = rxjs.from(this.delay('李'));
                ob.pipe(rxjs.operators.map(m=>`map：${m}`)).subscribe(rp=>console.log(rp));
                return ob;
            },
            async getData(){
                return await this.createObservable().toPromise();
            },
            async start() {
                let data = await this.getData();
                console.log(`最后：${data}`)
            }
        }
        a.start();
    </script>
</head>

<body>
    <div></div>
</body>

</html>